package core;

public class Player extends Actor {
	public Player() {
		super();
		this.setVisible(true);
	}

	public Player(Room room) {
		this();
		this.setPos(room.getEntrance().getPos());
		room.addElement(this);
	}

	@Override
	public void usePotion(Potion p, Room room) {
		intUsePotion(p, room);
	}

	private void intUsePotion(Potion p, Room room) {
		if (this.getPos() == p.getPos()) {
			this.setHp(this.getHp() + p.getPotency());
			if (this.getHp() > this.getMaxHp())
				this.setHp(this.getMaxHp());
			room.removeElement(p);
		}
	}

	@Override
	public String toString() {
		return "Player []" + super.toString();
	}
}
